<style scoped>
  .weui-form-preview__hd label, .weui-form-preview__hd em {
    font-size: .9em !important;
  }
  .rj-cell.max span{
    font-size: 16px;
    padding-right: 20px;
  }
  .rj-cell label {
    color: #333;
    font-size: 14px;
    width: 44%;
    display: inline-block;
    padding: 5px 3%;
    text-align: right;
  }
  .rj-cell span {
    font-size: 14px;
    color: #333;
    display: inline-block;
    width: 50%;
  }
  .rj-cell.note label{
    float: left;
  }
  .rj-cell.note span{
    width: 80%;
    display: inline-block;
  }
  .weui-cells {
    margin-top: 0;
  }
  .weui-cells_form {
    background: #fbfbfb;
  }
  .weui-cell {
    background: #fff;
  }
  #acts span {
    font-size: 14px;
  }
  .halfbtn {
    display: inline-block;
    width: 49%;
  }
  .weui-label{
    /*width: 130px;*/
    text-align: left;
  }

  .weui-select {
    height: auto;
    line-height: normal;
  }

  .weui-navbar a{
    text-decoration: none;color: #333;
  }

  .weui_tab_bd_item{
    display:none;height: 100%;overflow: auto;
  }

  .weui_tab_bd_item.weui_tab_bd_item_active{
    display:block;
  }

  *{
    list-style:none;
  }
  .delsty {
    position: absolute;
    top: 2px;
    right: 0px;
    z-index: 1000;
  }
</style>
<template>
  <div class="sendcar">
    <div class="rj-wrap">
      派车信息
      <a href="javascript:;" @click="$router.back(-1)" style="position: absolute; left: 10px; top: 8px">
        <img src="@/assets/back.png" style="width: 20px" /></a></div>
        <form method="post" id="formid">
    <div class="weui-tab">
      <div class="weui-navbar">
        <a class="weui-navbar__item weui-bar__item_on" href="#tab1">订单信息</a>
        <a class="weui-navbar__item" href="#tab2">陆运派车</a>
      </div>
      <div class="weui-tab__panel">
        <div id="tab1" class="weui_tab_bd_item weui_tab_bd_item_active">
          <div class="weui-cells weui-cells_form">
            <input name="entity.guid" id="guid" type="hidden" :value="wlinfo.guid" />
            <input name="entity.relatedid" id="orderid" type="hidden" :value="transferapply.guid" />

            <input name="entity.code" id="code" :value="wlinfo.code" type="hidden" />

            <input name="entity.faretype" id="faretype" :value="wlinfo.faretype" type="hidden" />
            <input name="entity.farepricetype" id="farepricetype" :value="wlinfo.farepricetype" type="hidden" />

            <input name="entity.type" id="type" :value="3" type="hidden" />
            <div class="cellgroup">
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">订单编号</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" readonly id="sellcode" :value="transferapply.code" name="sellcode" placeholder="请输入订单编号"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">申请人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="applyname" readonly type="text" name="applyname" :value="transferapply.applyname" placeholder="请输入申请人"></div>
              </div>
            </div>
            <div class="cellgroup">
              <div class="weui-cell fir">
                <div class="weui-cell__hd">
                  <label class="weui-label">发货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="delicontact" name="entity.delicontact" :value="wlinfo.delicontact" placeholder=" 请输入发货联系人"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">联系电话</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="delicontacttel" name="entity.delicontacttel" :value="wlinfo.delicontacttel" placeholder=" 请输入发货人手机号"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label id='unqualifiedchkrateDiv' class="weui-label">发货地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='deliprovince' name="entity.deliprovince"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">详细地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='deliaddress' name="entity.deliaddress" :value="wlinfo.deliaddress" placeholder=" 请输入发货详细地址"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">收货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="arricontact" name="entity.arricontact" :value="wlinfo.arricontact" placeholder="请输入收货联系人"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">联系电话</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="arricontactno" name="entity.arricontactno" :value="wlinfo.arricontactno" placeholder=" 请输入收货人手机号"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">收货地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='arriprovince' name="entity.arriprovince"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">详细地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='arriaddres' name="entity.arriaddres" :value="wlinfo.arriaddres" placeholder=" 请输入收货详细地址"></div>
              </div>
            </div>
          </div>
        </div>
        <div id="tab2" class="weui_tab_bd_item">
          <div class="weui-cells weui-cells_form">
            <div class="weui-cell fir" style="position: relative;">
              <div class="delsty"><i class="weui-icon-cancel" v-on:click="deleteCar"></i></div>
              <div class="weui-cell__hd">
                <label class="weui-label">物流公司</label></div>
              <div class="weui-cell__bd">
                <input class="weui-select" type="hidden" name="entity.customerid" :value="wlinfo.customerid" id="customerid" placeholder="请输入物流公司">
                <input class="weui-select" type="text" name="entity.customername" id="customername" :value="wlinfo.customername" placeholder="请输入物流公司"></div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">司机电话</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" type="number" id="driverphone" @blur="getWLDriver()" name="entity.driverphone" :value="wlinfo.driverphone" placeholder="请输入司机联系电话"></div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">司机姓名</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" type="text" required id="drivername" name="entity.drivername" :value="wlinfo.drivername" placeholder="请输入司机姓名"></div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">车型</label></div>
              <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="entity.carType" :value="wlinfo.carType"  placeholder="请输入车型"></div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label" id="acts">车牌号</label></div>
              <div class="weui-cell__bd">
                <input class="weui_input" name="entity.carcode" id="carcode" type="hidden" placeholder="请输入车牌号"  @change="checkCarcode">
                <div class="car_input">
                  <ul class="clearfix ul_input">
                    <li class="input_pro">
                      <span id="cn0"></span>
                    </li>
                    <li class="input_pp input_zim">
                      <span id="cn1"></span>
                    </li>
                    <li class="input_pp">
                      <span id="cn2"></span>
                    </li>
                    <li class="input_pp">
                      <span id="cn3"></span>
                    </li>
                    <li class="input_pp">
                      <span id="cn4"></span>
                    </li>
                    <li class="input_pp">
                      <span id="cn5"></span>
                    </li>
                    <li class="input_pp">
                      <span id="cn6"></span>
                    </li>
                  </ul>
                </div>
              </div>
            </div>
            <div class="weui-cells weui-cells_form">
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">结算方式</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="faretypeC" name="faretypeC"  placeholder="运费结算方式"></div>
              </div>
            </div>
            <div class="weui-cells weui-cells_form">
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">运价</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="fareprice" name="entity.fareprice" :value="wlinfo.fareprice" placeholder="运价" style="width: 45%;">
                  <input class="weui-select" type="text" id="farePriceTypeC" name="farePriceTypeC" placeholder="运价方式" style="width: 51%; padding-left: 0;"></div>
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__bd">
                <textarea class="weui-textarea opinion" id="opinion" name="opinion" placeholder="请输入备注内容" rows="2"></textarea>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>
          <div ref="actHtml" class="fixcont">
            <div class="weui-btn-area">
              <a class="weui-btn weui-btn_primary halfbtn subbtn" href="javascript:" @click="send">提交</a>
              <a class="weui-btn weui-btn_primary halfbtn subbtn" v-if="refuseflag == 1" href="javascript:" @click="rejectIt">拒绝</a>
              <a class="weui-btn weui-btn_primary halfbtn" v-else  href="javascript:" @click="$router.back(-1)" id="sub">返回</a>
            </div>
          </div>
    </form>
    <div id="bmlogs">
      <OperationLogs2 :nodeid="nodeid" :orderid="guid" :srguid="transferapply.status <= 15 ? transferapply.fromsrguid : transferapply.tosrguid" :departid="''"></OperationLogs2>
    </div>
  </div>
</template>

<script>
    import OrderBaseInfo from '../../common/OrderBaseInfo'
    import OperationLogs2 from '../../common/OperationLogs2'

    export default {
    name: 'reSendCar',
    data () {
      return {
        guid : "",
        nodeid: '',
        status: '',
        wlinfo: {}, //物流信息
        adatas: [],
        transferapply:{},
        sellforms:[],
        driveName:'',
        order:{},
        refuseflag: '',
        refuseNodes: [],
      }
    },
    created() {
      //刷新
      if (location.href.indexOf("#reloaded") == -1) {
        location.href = location.href + "#reloaded";
        location.reload();
      }
    },
    components: {
        OrderBaseInfo,
      OperationLogs2
    },


    mounted () {
      //提交操作定位到页面底部
      //$('#bmlogs').css('margin-bottom', this.$refs.actHtml.offsetHeight);
      //
      // if(location.href.indexOf("&reloaded")==-1){
      //   location.href=location.href+"&reloaded";
      //   location.reload();
      // }

      $('.weui-navbar__item').on('click', function () {
            $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');

            //内容切换
            $(".weui-tab__panel .weui_tab_bd_item_active").removeClass('weui_tab_bd_item_active');
            var data_toggle =jQuery(this).attr("href");
            $(data_toggle).addClass("weui_tab_bd_item_active");
        });


      // //编辑车牌号后赋值
      // $(".input_pp span").bind("DOMNodeInserted",function(e){
      //   var car = $('#cn0').text() + $('#cn1').text() + $('#cn2').text() + $('#cn3').text() + $('#cn4').text() + $('#cn5').text() + $('#cn6').text();
      //   $('#code').val(car);
      // })

      let that = this;
      that.guid = that.$route.query.guid;
      that.nodeid = that.$route.query.nodeid;
      //this.guid = this.$parent.getQueryVariable('guid');

      console.log()
      //获取回显数据
      $.ajax({
        url: '/wlinfo/Wlinfo!reToSendCar.action',
        data: {guid:that.guid},
        type: "post",
        dataType: "json",
        success: function(res) {
          if (res.result) {
            that.transferapply = res.data.transferapply;
            that.wlinfo = res.data.wlinfo;
            if(that.wlinfo != null && that.wlinfo != ""){
                if(that.wlinfo.faretype == 1){
                  $("#faretypeC").val("公司结算");
                }else if(that.wlinfo.faretype == 2){
                    $("#faretypeC").val("客户结算");
                }

                if(that.wlinfo.farepricetype == 1){
                  $("#farePriceTypeC").val("元/车");
                }else if(that.wlinfo.farepricetype == 2){
                  $("#farePriceTypeC").val("元/吨");
                }

                that.loadCarCode(that.wlinfo.carcode);
                $('#deliprovince').val(that.wlinfo.deliprovince + " " + that.wlinfo.delicity + " " +that.wlinfo.delidistrict);
                $('#arriprovince').val(that.wlinfo.arriprovince + " " + that.wlinfo.arricity + " " +that.wlinfo.arridistrict);

            }

          }



        },
        complete: function () {

        }
      });
      //获取回显数据
      $.ajax({
        url: '/sales/Sellform!getWlCompany.action',
        data: {},
        type: "post",
        dataType: "json",
        success: function(res) {
          if (res.info != null) {

            var data = res.info;
            var datalist = new Array;
            $.each( data, function( index, itsm ) {
              var info = { "title": itsm.name, "value": itsm.guid };
              datalist.push(info);
            });

            $('#customername').select({
              title: "物流公司",
              items: datalist,
              onChange: function (data) {
                $('input[name="faretype"]').val($('#wlcompany').data('values'));
                $('#customername').val(data.titles);
                $('#customerid').val(data.values);
              }
            });

            $('#customernameSea').select({
              title: "物流公司",
              items: datalist,
              onChange: function (data) {
                $('#customernameSea').val(data.titles);
                $('#customeridSea').val(data.values);
              }
            });
          } else if (res != undefined && res.msg == 'sessionTimeOut') {
          //不不设置提示
        } else {
            that.toastError('系统出现异常!');
          }
        },
        complete: function () {

        }
      });


        $('#faretypeC').select({
            title: "运费结算方式",
            items: [{ "title":"公司结算", "value": 1 },{ "title":"客户结算", "value": 2 }],
            onChange: function (data) {
                $('input[name="wlcompanyguid"]').val($('#wlcompany').data('values'));
                $('#faretype').val(data.values);
            }
        });


      //获取回显数据
      $.ajax({
        url: '/sales/Sellform!getDictEmnu.action',
        data: {dicttype:"94"},
        type: "post",
        dataType: "json",
        success: function(res) {
          console.log("111",res)
          if (res.info != null && res.info != 'error') {
            var data = res.info;
            var datalist = new Array;
            $.each( data, function( index, itsm ) {
              var info = { "title": itsm.dicttext, "value": itsm.dictkey };
              datalist.push(info);
              if( $('#farepricetype').val() == itsm.dictkey){
                $('#farePriceTypeC').val(itsm.dicttext);
              }
            });
            $('#farePriceTypeC').select({
              title: "运价方式",
              items: datalist,
              onChange: function (data) {
                 $('#farepricetype').val(data.values);
               // console.log(data)
                //$('input[name="farepricetype"]').val($('#farePriceTypeC').data('values'));
              }
            });
          } else {
            that.toastError('系统出现异常!');
          }
        },
        complete: function () {

        }
      });

      $("#deliprovince").cityPicker({
        title: "请选择发货地址",
      });
      $("#arriprovince").cityPicker({
        title: "请选择收货地址"
      });

      //编辑车牌号后赋值
      $(".input_pp span").bind("DOMNodeInserted",function(e){
        var car = $('#cn0').text() + $('#cn1').text() + $('#cn2').text() + $('#cn3').text() + $('#cn4').text() + $('#cn5').text() + $('#cn6').text();
        $('#carcode').val(car);
        console.log($('#carcode').val().length)


      })

      this.refuseflag = this.$route.query.refuseflag;
      this.getRefuseNodes();

    },
    methods: {

        deleteCar: function(){
          var result = confirm("确认删除该派车信息？");
          if(!result){
            return;
          }
          var guid = $("#guid").val();
          if($('#carcode').val() == null || $('#carcode').val() == ""){
            alert("该物流还没有进行派车");
            return;
          }
          $.ajax({
            url: '/wlinfo/Wlinfo!deleteCar.action',
            data: {linkcode : this.transferapply.code},
            type: "get",
            dataType: "json",
            success: function(res) {
              console.log("res",res)
              if(res.msg == "删除成功"){
                $('#carcode').val("");
                $("#driverphone").val("")
                $("#drivername").val("")
                $("#customerid").val("")
                $("#customername").val("")
                $("#fareprice").val("")
                $("#cn0").html("")
                $("#cn1").html("")
                $("#cn2").html("")
                $("#cn3").html("")
                $("#cn4").html("")
                $("#cn5").html("")
                $("#cn6").html("")
                alert(res.msg)
              }else{
                alert(res.msg)
               // return;
              }
            }
          });
        },

        checkCarcode: function(e){
          console.log(e.target.value)
          console.log(e.target.value.length)
          $.ajax({
            url: '/wlinfo/Wlinfo!checkWlByCarcode.action',
            data: {carCode:e.target.value,status:7},
            type: "get",
            dataType: "json",
            success: function(res) {
              console.log("res",res)
              }
          });

        },
        send: function() {
          let that = this;
          // if(that.adata.carcode != $('#carcode').val()){
          //   if($('#carcode').val().length == 7 ){
          //   console.log(1111111);
          //   $.ajax({
          //     url: '/wlinfo/Wlinfo!checkWlByCarcode.action',
          //     data: {carCode:$('#carcode').val(), guid : $("#guid").val()},
          //     type: "get",
          //     async: false,
          //     dataType: "json",
          //     success: function(res) {
          //       console.log("checkWlByCarcode",res);
          //       if(res.result == "false"){
          //         alert("该车已不能派送");
          //         return;
          //       }else{
                  if(!checkSubmit()){
                    return;
                  }

                    //防止重复提交
                    $('.subbtn').attr("disabled",true).css("pointer-events","none");
        //显示提交状态
        $.showLoading("正在提交");

                 that.axios({
                    method: 'post',
                    url: '/wlinfo/Wlinfo!reSendCar.action?nodeid=' + that.nodeid,
                    params: that.serialize2Obj($("#formid").serializeArray())
                  }).then(response => {
                    //恢复提交按钮可点击
                    $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
                    console.log(response)
                    if(response.data.result){
                      that.toastSuccess('操作成功!');
                      that.$router.push({name: 'TransferApplyList', query:{type: 1}});
                    } else{
                      that.toastError('操作失败!');

                    }

                  }).catch(function (error) {
                    //恢复提交按钮可点击
                    $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
                    that.toastError('系统错误');
                  });

            //     }
            //   }
            // });
      },
      serialize2Obj: function (data) {
        var obj = {};
        $.each(data,function(i,v){
          obj[v.name] = v.value;
        })
        return obj;
      },

      getWLDriver:function(){
        let that = this;
        this.axios({
          method: 'post',
          responseType: 'json',
          headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
          url: '/wlinfo/Wlinfo!getWlDriver.action',
          params: {mobilephone:$('#driverphone').val()}
        }).then(response => {
          console.log("response",response)
          var res = response.data;

          if (res.info != 'error' && res.info != 'wlError'  ) {
            var info = res.info;
             //判断司机是否有订单
            //  let isOrder = info.isOrder;
            //  if(isOrder == "true"){
            //      this.transferapplys = info.transferapplys;
            //      this.sellforms = info.sellforms;
            //  }else{
            //      // $.confirm("是否拼装？", function () {
            //      //
            //      //     that.transferapplys = [{"status":"已完成","createtime": "2020-4-2","code":"11122222","fromsrname":"宇","tosrname":"客户","applyname":"申请人"}]
            //      //     that.sellforms =  [{"status":"已完成","createtime":  "2020-4-2","sellcode":"11122222","applyname":"宇","customername":"客户"}]
            //      // })
            //      that.transferapplys = [{"status":"已完成","createtime": "2020-4-2","code":"11122222","fromsrname":"宇","tosrname":"客户","applyname":"申请人"}]
            //      that.sellforms =  [{"status":"已完成","createtime":  "2020-4-2","sellcode":"11122222","applyname":"宇","customername":"客户"}]

            //  }


              console.log(info.driveInfo)
              //赋值司机信息
              let driveInfo =  info.driveInfo;
              that.wlinfo.drivername = driveInfo.drivername
              that.wlinfo.driverphone = driveInfo.driverphone
              that.wlinfo.carcode = driveInfo.code;
              $("#drivername").val(driveInfo.drivername);
              $("#carcode").val(driveInfo.code);
              that.setValues();
              //加载车牌号信息
              that.loadCarCode(driveInfo.code);
              //如果不抛出异常，则会调用回调刷新方法
             // throw Exception;
           // that.checkCarcode;




          }
          if(res.info == 'error' ){
              that.toastError('系统异常!');
          }
          if(res.info == 'wlError'){
              that.toastError('物流平台系统异常!');
          }
        });
      },
      loadCarCode :function (carCode){
        if(carCode == '' || carCode==undefined){
            return;
        }
        $('#cn0').text(carCode.substring(0,1));
        $('#cn1').text(carCode.substring(1,2));
        $('#cn2').text(carCode.substring(2,3));
        $('#cn3').text(carCode.substring(3,4));
        $('#cn4').text(carCode.substring(4,5));
        $('#cn5').text(carCode.substring(5,6));
        $('#cn6').text(carCode.substring(6,7));
        console.log(2)

      },
        setValues :function (){
            //this.wlinfo.sellcode=$('#sellcode').val();
            // this.wlinfo.applyname=$('#applyname').val();
            // this.wlinfo.delicontact=$('#delicontact').val();
            // this.wlinfo.delicontacttel=$('#delicontacttel').val();
            // this.wlinfo.deliprovince=$('#deliprovince').val();
            // this.wlinfo.deliaddress=$('#deliaddress').val();
            // this.wlinfo.arricontact=$('#arricontact').val();
            // this.wlinfo.arricontacttel=$('#arricontacttel').val();
            // this.wlinfo.arriprovince=$('#arriprovince').val();
            // this.wlinfo.arriaddres=$('#arriaddres').val();
            // this.wlinfo.customername=$('#customername').val();
            // this.wlinfo.driverphone=$('#driverphone').val();
            // this.wlinfo.drivername=$('#drivername').val();
            // this.wlinfo.carcode=$('#carcode').val();
            this.wlinfo.customername=$('#customername').val();
            this.wlinfo.fareprice=$('#fareprice').val();
            this.wlinfo.farepricetype=$('#farepricetype').val();
            this.wlinfo.faretype=$('#faretype').val();
            this.wlinfo.customerid=$('#customerid').val();

      },
      openLogs: function() {
        this.$router.push({name: 'OperationLogs2', query: {orderid: this.guid, srguid: this.transferapply.status <= 15 ? this.transferapply.fromsrguid : this.transferapply.tosrguid, departid: ''}});
      },

      getRefuseNodes: function() {
        let that = this;
        this.axios({
          method: 'get',
          url: '/sales/Flowtempnode!getRefuseNodes.action',
          params: {orderid: this.guid, nodeid: this.nodeid}
        }).then(response => {

          if (response.data.msg == 'success') {
            this.refuseNodes = response.data.optNodes.map(function (item) {
              return {text: item.name,
                onClick: function() {
                  $.confirm("确定要将订单回退到 " + item.name + " 节点？", function() {
                    that.doReject(item.guid, item.name, item.operatorid);
                  })
                }};
            });
          } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
            //不不设置提示
          } else {
            this.toastText('获取可回退节点数据失败!');
          }
        });
      },
      rejectIt: function () {
        if (!this.checkEmy('opinion')) {
          this.toastText('意见不能为空！');
          return false;
        }
        if (this.refuseNodes.length > 0) {
          $.actions({
            title: '选择回退节点',
            actions: this.refuseNodes
          });
        } else {
          this.toastText('无可回退节点！');
          return false;
        }
      },
      doReject: function (refuseNodeid, refuseNodename, refuseOperatorid) {
        let that = this;

        //防止重复提交
        $('.subbtn').attr("disabled",true).css("pointer-events","none");
        //显示提交状态
        $.showLoading("正在提交");

        let postData = {};
        // postData.imgids = this.images.serverId.join(',');
        postData.imgids = '';
        postData.transferid = this.guid;
        postData.opinion = ($('#opinion').val() || '') + ' 退回到' + refuseNodename;
        postData.nodeid = this.nodeid;
        postData.refuseNodeid = refuseNodeid;
        postData.backUserid = refuseOperatorid;
        this.axios({
          method: 'post',
          url: '/produce/Transferapply!refuse.action',
          params: postData
        }).then((response) => {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();

          if (response.data.msg == 'success') {
            this.toastSuccess('提交成功!');
            this.$router.push({name: 'TransferApplyList', query:{type: this.type}});
          } else if (response.data.msg == 'canotopt') {
            this.toastText('不允许的操作！');
          } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
            //不不设置提示
          } else {
            this.toastError('系统错误');
          }
        }).catch(function (error) {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
          that.toastError('系统错误');
        });
      },
    }
  }

  /**
   * 提交之前的校验
   */
  function checkSubmit(){

    //物流公司
    if(isEmpty("customerid")){
      alert("请选择物流公司");
      return false;
    }
    if(isEmpty("drivername")){
      alert("请填写司机姓名");
      return false;
    }
    if(isEmpty("driverphone")){
      alert("请填写司机电话");
      return false;
    }
    if(isEmpty("carcode")){
      alert("请填写车牌号");
      return false;
    }
    if(isEmpty("faretypeC")){
      alert("请选择结算方式");
      return false;
    }
    if(isEmpty("farepricetype")){
      alert("请选择运价方式");
      return false;
    }

    if(isEmpty("fareprice")){
      alert("请填写运价");
      return false;
    }




    if(isEmpty("delicontact")){
      alert("请填写发货联系人");
      return false;
    }
    if(isEmpty("delicontacttel")){
      alert("请填写发货联系人手机号");
      return false;
    }
    if(isEmpty("deliprovince")){
      alert("请填写发货地址");
      return false;
    }
    if(isEmpty("deliaddress")){
      alert("请填写发货详细地址");
      return false;
    }


    if(isEmpty("arricontact")){
      alert("请填写收货联系人");
      return false;
    }
    if(isEmpty("arricontacttel")){
      alert("请填写收货联系人手机号");
      return false;
    }if(isEmpty("arriprovince")){
      alert("请填写收货地址");
      return false;
    }if(isEmpty("arriaddres")){
      alert("请填写详细收货地址");
      return false;
    }

    if($("#farepricetype").val() == 0){
      alert("请选择运价方式");
      return false;
    }
    if($("#fareprice").val() == 0){
      alert("请输入运价");
      return false;
    }









    return true;
  }

  function isEmpty(domID){

    return $('#' + domID).val() == "" || $('#' + domID) == null;
  }


  $(function(){

    });

function checkCarcode(){
  console.log(123)
}

</script>
